package com.lm.activiti.boot.spring.aop;

import com.lm.activiti.boot.spring.aop.service.MyService;
import org.springframework.beans.factory.support.BeanDefinitionReader;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

/**
 * @author lm_jcf
 * @date 2021/1/26 14:39
 */
public class SpringAopCase {

    public static void main(String[] args) {

        Resource resource = new ClassPathResource("applicationContextAop.xml");

        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();

        BeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);

        reader.loadBeanDefinitions(resource);

        MyService myService = (MyService) beanFactory.getBean("myAop");

        myService.myMethod();

    }
}